import request from "@/utils/httpRequest";
import { AxiosPromise } from "axios";
import {TypeBbuReturnActionPageQueryI,TypeBbuReturnActionTablePageVoI} from './bbu_return_action_type'
import { TypePageQueryTableUrlI, } from "@/components/page_query_table/types/page_query_table_types";
import {TypeBbuStatisticsDataI} from '@/api/current_status/bbu_board_status/bbu_board_status_types'
const prefixUrlOfAction="/api/v1/bbu_return/action/"


let pageTableUrlObj:TypePageQueryTableUrlI={
    queryUrl:`${prefixUrlOfAction}page`,
    importUrl:`${prefixUrlOfAction}import`,
    deleteByIdArrayUrl:`${prefixUrlOfAction}deleteByIdArray`,
    downloadTemplateUrl:`${prefixUrlOfAction}downloadTemplate`,
    exportQueryUrl:`${prefixUrlOfAction}exportQuery`,
    exportAllUrl:`${prefixUrlOfAction}exportAll`,
}

//get page
export function getPage(pageQueryParameters:TypeBbuReturnActionPageQueryI):AxiosPromise<TypeBbuReturnActionTablePageVoI>{
    return request({
        url: pageTableUrlObj.queryUrl,
        // url:'/api/v1/current_pon_apparatus_room/page',
        method: 'post',
        data: pageQueryParameters,
    })
}

/**
 * 导出全部
 *
 * @param queryParams
 * @returns
 */
export function exportAll() {
    return request({
        url: pageTableUrlObj.exportAllUrl,
        method: 'get',
        responseType: 'arraybuffer',
    })
}

export function calBbuReturnAction(){
    return request({
        url: `${prefixUrlOfAction}calAction`,
        method: `post`,
    })
}

export function calBoardStatisticDataList():AxiosPromise<TypeBbuStatisticsDataI[]>{
    return request({
        url: `${prefixUrlOfAction}calBoardStatisticDataList`,
        method: `get`,

    })
}



